﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using InfoPick.Lib.Tools;
using InfoPick.Lib.Entity;

namespace InfoPick.Lib.StringResolve
{
    public class GSN7LNKResolver
    {
        public static List<GSN7LNK> ResolveList(string str)
        {
            List<GSN7LNK> list = new List<GSN7LNK>();
            if (!string.IsNullOrEmpty(str))
            {
                //2种链路类型:64K 2M
                {
                    var table = StringTools.GetTable(str, "No.7链路表(TDM 64K链路)", "(结果个数");
                    foreach (var item in table)
                    {
                        var obj = GSN7LNK.Create64K(item);
                        if (obj != null)
                            list.Add(obj);
                    }
                    
                }
                {
                    var table = StringTools.GetTable(str, "No.7链路表(TDM 2M链路)", "(结果个数");
                    foreach (var item in table)
                    {
                        var obj = GSN7LNK.Create2M(item);
                        if (obj != null)
                            list.Add(obj);
                    }
                }
            }
            int idx = 1;
            foreach (var item in list)
            {
                item.Idx = idx++;
            }
            return list;
        }
    }

    
}
